<?php
$smarty -> template_dir = LOCAL_PATH.'components/test/templates/';
$smarty -> compile_dir = LOCAL_PATH.'components/test/templates_c/';

if(!(isset($_SESSION['category_id'])) || $_SESSION['category_id'] == ''){
		$smarty -> assign('component', 'test');
		$smarty -> assign('title','Error');
		$smarty -> assign('warning',"You must select subject to start test.");
		$smarty -> display('error.tpl');
		die("Sorry");
}

require("classes/choice.php");

if($_GET['task'] == 'check'){
	include("functions/check.php");
	exit;
}else if($_GET['task'] == 'new'){
	include('functions/new_quiz.php');
	exit;
}else if($_GET['task'] == 'load'){
	include('functions/load_quiz.php');
	exit;
}

$r = mysql_query("select * from user_temp_result where u_id='".$_SESSION['user_id']."'");
$row_r = mysql_fetch_array($r);

if(sizeof($row_r) > 1){
	include ("question.php");
	exit;
}else{
	include("functions/new_quiz.php");
	exit;
}

?>